<extend name="Public:common" />
<!--/sidebar-->
<block name="content">
  <!--/sidebar-->
  <div class="main-wrap">

    <div class="crumb-wrap">
      <div class="crumb-list"> <i class="icon-font"></i>
        <a href="__MODULE__/Index/index">首页</a>
        <span class="crumb-step">&gt;</span>
        <a class="crumb-name" href="__MODULE__/Rbac/role">角色分组列表</a>
        <span class="crumb-step">&gt;</span>
        <span>编辑角色</span>
      </div>
    </div>
    <div class="result-wrap">
      <div class="result-content">
        <form action="__MODULE__/Rbac/editrole" method="post" id="login" name="login" onsubmit="return Validator.ValidateForm(this,3);">
          <input type='hidden' name='action' value='eidt' />
          <input type='hidden' name='p' value='<{$p}>
          ' />
          <input type='hidden' name='id' value='<{$Rone.id}>
          ' />
          <table class="insert-tab" width="100%">
            <tbody>
              <tr>
                <th width="120"> <i class="require-red">*</i>
                  角色中文名：
                </th>
                <td>
                  <input class="common-text input" type='text' id='remark' dataType="Custom"  name='name' size='30' regexp="^[\u4E00-\u9FA5]{1,10}$"  msg="（中文不能超过10个汉字)" value='<{$Rone.name}>
                  ' onBlur="Validator.Validate(this)"/>
                  <span id='remarkWarning'>(中文角色名)</span>
                </td>
              </tr>
<!--               <tr>
                <th width="120">
                  <i class="require-red">*</i>
                  角色名：
                </th>
                <td>
                  <input class="common-text input" type='text' id='name' dataType="Custom"  name='name' size='30' regexp="^\w{4,15}$"  msg="（输入字母、数字或下划线（5-16位），必须以字母开头）"  value='<{$Rone.name}>
                  ' onBlur="Validator.Validate(this)"/>
                  <span id='nameWarning'></span>
                </td>
              </tr> -->
              <tr>
                <th width="120">
                  <i class="require-red">*</i>
                  父角色：
                </th>
                <td>
                  <select name='pid'>
                    <option value='0' >|-- 父角色</option>
                    <volist name='rlist' id='vo'>
                      <?php 
                  if($vo['id'] == $Rone['id']){ //禁用
                ?>
                      <option value='<{$vo.id}>
                        ' disabled="true" >|--
                        <{$vo.name}></option>
                        <?php   
                  }else{
                                ?>
                        <option value='<{$vo.id}>
                          '
                          <?php echo  $Rone['pid'] == $vo['id']?'selected':''; ?>
                          >|--
                          <{$vo.name}></option>
                          <?php
                                  }
                               ?></volist>
                      </select>

                    </td>
                  </tr>
                  <tr>
                    <th width="120">
                      <i class="require-red">*</i>
                      状态：
                    </th>
                    <td>
                      <input type='radio' name='status' value='1' <?php echo $Rone['status']==1?"checked":''; ?>
                      /> 开启&nbsp;&nbsp;
                      <input type='radio' name='status' value='0' <?php echo $Rone['status']==0?"checked":''; ?>/> 关闭</td>
                  </tr>
                  <tr>
                    <th width="120">
                      <i class="require-red">*</i>
                      权限：
                    </th>
                    <td>
                      <style>
                #all li input{
                  margin:15px;
                }
                #all li{
                  font-family : KaiTi;
                  width:250px;
                  display:inline-block;
                  margin :2px;
                  box-shadow: 5px 5px 5px #888888;
                  border-radius:25px;
                  -moz-border-radius:25px; /* Old Firefox */
                }
                #all li.one{
                  border:1px solid red;
                  text-shadow: 5px 5px 5px #FFA68E;
                }
                #all li.two{
                  border:1px solid blue;
                  text-shadow: 5px 5px 5px #74B1FF;
                }
                #all li.three{
                  border:1px solid orange;
                  text-shadow: 5px 5px 5px #74af33;
                }
                #all li .imgs{
                  position:relative;
                  right:-37px;
                }
                
                    </style>
                      <ul id='all'>
                        <volist name='nlist' id='vo'>
                          <!-- 第一层 项目权限 -->
                          <li class='one'>
                            <img class='imgs' src='__IMG__/<?php echo in_array($vo['id'],$Rone['node'])==true?"/check_right.gif":'check_error.gif';?>
                            ' height='20' width='20' />
                            <input type='checkbox' name='node[]' value="<{$vo['id']}>
                            "
                            <?php echo in_array($vo['id'],$Rone['node'])==true?"checked class='chkcss'":'';?>
                            />
                            <{$vo['title']}></li>
                            <hr />
                            <ul>
                              <volist name='vo["children"]' id="vo2">
                                <li class='two'>
                                  <img class='imgs' src='__IMG__/<?php echo in_array($vo2['id'],$Rone['node'])==true?"check_right.gif":'check_error.gif';?>
                                  ' height='20' width='20' />
                                  <!-- <img class='imgs' src='__IMG__/check_right.gif' />
                                  -->
                                  <input type='checkbox' name='node[]' value="<{$vo2['id']}>
                                  "
                                  <?php echo in_array($vo2['id'],$Rone['node'])==true?"checked class='chkcss'":'';?>
                                  />
                                  <{$vo2['title']}></li>
                                  <ul class="right">
                                    <volist name='vo2["children"]' id="vo3">
                                      <li class='three'>
                                        <img class='imgs' src='__IMG__/<?php echo in_array($vo3['id'],$Rone['node'])==true?"check_right.gif":'check_error.gif';?>
                                        ' height='20' width='20' />
                                        <input type='checkbox' name='node[]' value="<{$vo3['id']}>
                                        "
                                        <?php echo in_array($vo3['id'],$Rone['node'])==true?"checked class='chkcss'":'';?>
                                        />
                                        <{$vo3['title']}></li>
                                      </volist>
                                    </ul>
                                    <hr ></volist>
                                  <ul></volist>
                                </ul>
                              </td>
                            </tr>
                            <tr>
                              <td></td>
                              <td>
                                <input class="btn btn-primary btn6 mr10" value="提交编辑" type="submit">
                                <input class="btn btn6"  onclick="history.go(-1)" value="返回" type="button"></td>
                            </tr>
                          </tbody>
                        </table>
                      </form>
                      <script>
                //点击 li 标签 就会触发点击时间0
                  $("#all li").mouseover(function(){
                        color = $(this).css("background-color"); 
                      $(this).css("background-color","#FFF500");
                  }).mouseout(function(){
                      $(this).css("background-color",color);
                  }).click(function(){
                    var input = $(this).find("input");
                    $(this).find("input").bind( //阻止冒泡 事件
                        　　"click",
                        　　function(event){
                            event.stopPropagation(); //阻止一次起泡事件
                        　　}).trigger("click");
                      var src = $(this).find("img").attr('src');
                      if(src.indexOf('right') == -1){//判断图片是对是错
                        $(this).find("img").attr('src',"__IMG__/check_right.gif");
                      }else{
                        $(this).find("img").attr('src',"__IMG__/check_error.gif");
                      }
                    });
                </script>
                    </div>
                  </div>

                </div>
                <!--/main--> </block>